package com.chart.chart.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chart.chart.domian.ChartConfigs;
import com.chart.chart.domian.ChartSettings;
import com.chart.chart.domian.ChartStatistics;
import com.chart.chart.domian.vo.StatisticsVo;
import com.chart.chart.mapper.ChartConfigsMapper;
import com.chart.chart.mapper.ChartStatisticsMapper;
import com.chart.chart.service.IChartConfigsService;
import com.chart.chart.service.IChartStatisticsService;
import com.chart.common.core.domain.AjaxResult;
import com.chart.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.List;

/**
 * 用户 业务层处理
 * 
 * @author ruoyi
 */
@Service
public class ChartStatisticsServiceImpl extends ServiceImpl<ChartStatisticsMapper, ChartStatistics> implements IChartStatisticsService
{

    @Autowired
    private ChartStatisticsMapper statisticsMapper;
    @Override
    public List<StatisticsVo> getOpers(ChartStatistics chartStatistics) {
        return statisticsMapper.getOpers(chartStatistics);
    }

    /**
     * 使用说明点击的PV、UV

     * @return 页面访问（PV）和唯一访客（UV）
     */

    @Override
    public AjaxResult operationPv() {
        Long userId = SecurityUtils.getUserId();
       //  Long userId = 2L;
        Long operationTotal = 1L; // 设置要插入的操作总数

        // 调用 Mapper 方法
        statisticsMapper.incrementOperationTotal(userId, operationTotal);

        return AjaxResult.success("操作记录成功");
    }


    @Override
    public AjaxResult operationTotal() {
        Long userId = 2L;
      //  Long userId = SecurityUtils.getUserId();
        return statisticsMapper.operationTotal(userId);
    }




}

